<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>用其他变量的值为变量赋值</title>
</head>
<body>
<script>
    var string1 = "Hello";
    var string2 = "Goodbye";

    alert(string1);
    alert(string2);

    string2 = string1;

    alert(string1);
    alert(string2);

    string1 = "Now for something different";

    alert(string1);
    alert(string2);
</script>
</body>
</html>